home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2010 Summer - Disc 1
/
WN_Ete2010_CD1.iso
/
Onglet5
/
Weezo
/
Weezo setup.exe
/
{code_appDir}
/
www
/
js
/
musicDB.js
< prev
next >
Wrap
Text File
|
2010-05-19
|
9KB
|
1 lines
var mDBGroupBy,mDBDisplayType,mDBMixedFilter;var mDBDestId;var mDBDestIdUnfolded;var mDBData;var mDBNbItems;function init(a){plRefresh(a);dgi("searchInput").focus();fas("","refreshDisplay")}function winResized(a,b){resizeDivs()}function coversDetailSetMargins(b){var a=dgi("det"+b).style;a.marginLeft=(10-1*dgi("id"+b).offsetLeft)+"px";a.width=(0.99*dgi("selectionDiv").offsetWidth-40)+"px";a.marginRight=(30-dgi("id"+b).offsetLeft-dgi("selectionDiv").offsetWidth)+"px";a.display=""}function coversDetailSetMarginsWA(b,a){if(a=="doneUnfold"&&mDBDisplayType==="covers"){coversDetailSetMargins(b.substr(3));wl.fadeStyle("selectionDiv","scrollTop",dgi("id"+mDBDestId).offsetTop-((phpBrowser=="ie")?0:36),"exponential",3)}}function coverLoaded(a){if(a.offsetWidth==1){a.src=coverDefaultSrc}else{if(mDBNbItems>40||a.offsetWidth==0){a.style.visibility=""}else{fade(a,0,1,3)}}}function updateDatabase(){fas(false,"updateDatabase",false,false,"sync")}function formatedTime(c){if(!c){return"-"}var a=Math.floor(c/3600),b=Math.floor(Math.floor((c%3600))/60),d=Math.floor(c%60);if(a>0&&b<10){b="0"+b}if(d<10){d="0"+d}if(a>0){return hmsCaption.replace(/%1/,a).replace(/%2/,b).replace(/%3/,d)}else{return msCaption.replace(/%1/,b).replace(/%2/,d)}}function insertCover(b,a){if(a.length>0){if(sourceType=="iTunes"){b=b.replace(/COVERSRC/g,coverTemplate).replace(/IMAGEPATH/,a.replace(/#/,lPID))}else{b=b.replace(/COVERSRC/g,coverTemplate).replace(/IMAGEPATH/,a)}}else{b=b.replace(/COVERSRC/g,coverDefaultSrc)}b=b.replace(/EXTRAHTML=""/i,'width="'+fCW+'" height="'+fCW+'"');return b.replace(/imgtag/gi,"img")}function playTrack(a){view(a,dAWW,dAWH)}function playAlbum(a,b){view("album/"+a+"/"+b,dAWW,dAWH)}function playArtist(a){view("artist/"+a,dAWW,dAWH)}function inlineSetSongPlayed(c,a,b,d){dgi("inlinePlayerImg").src=c;dgi("inlineArtist").innerHTML=a;dgi("inlineAlbum").innerHTML=b;dgi("inlineTitle").innerHTML=d}function inlineUpdatePlayerInfo(a){fas(a,"inlineUpdatePlayerInfo")}function plAddArtist(a){if(mIsProcessing){return}mProcessing(true);fas(a,"plAddArtist")}function plAddAlbum(a,b){if(mIsProcessing){return}mProcessing(true);fas(a,"plAddAlbum",b)}function plAddPlaylist(a){if(mIsProcessing){return}mProcessing(true);fas(a,"plAddPlaylist")}function plAddTrack(a){if(mIsProcessing){return}mProcessing(true);fas(a,"plAddTrack")}function plAddAllShuffle(){if(mIsProcessing){return}mProcessing(true);fas(0,"plAddAllShuffle")}function changeDisplayType(a){fas(a,"changeDisplayType")}function changeItemsPerPage(a){fas(a,"changeItemsPerPage")}function changeOffset(a){fas(a,"changeOffset")}function groupBy(a){dgi("groupBy"+a).checked="checked";fas(a,"changeGroupBy")}function search(a){searchValue=a;dgi("groupBySearch").checked="checked";fas(a,"search")}function searchRealTime(a){if(searchValue==a){return}searchValue=a;dgi("groupBySearch").checked="checked";fas(a,"search",1)}function validateSearch(a){if(a){kc=a.which}else{if(W.event){kc=W.event.keyCode}else{return}}if(kc==13&&dgi("searchInput").value!=""){search(dgi("searchInput").value)}if(dgi("searchInput").value.length>2){searchRealTime(dgi("searchInput").value)}}function showDetail(f,b,d,e,a){var g=dgi("det"+e),c=dgi("id"+e);if(mDBDestId&&!a){hideDetail(mDBDestId,mDBDestId!=e);if(mDBDestId===e){mDBDestId=false;return}}mDBDestId=e;if(!a){wl.fadeStyle("selectionDiv","scrollTop",dgi("id"+e).offsetTop-((phpBrowser=="ie")?0:36),"exponential",10,"unfoldDetail()");if(g.innerHTML!=""){return}}else{if(g.innerHTML!=""&&mDBDestIdUnfolded==e){unfoldDetail()}}if(!g.innerHTML){D.comForm.data1.value=d;fas(b,"showDetail",e,f);D.comForm.data1.value="*resSpecific*"}}function unfoldDetail(){var a=mDBDestId,b=dgi("det"+a);mDBDestIdUnfolded=mDBDestId;if(!b.innerHTML){return}if(mDBDisplayType=="covers"){coversDetailSetMargins(a)}dgi("col"+a).style.display="inline";wl.nodeCollapseToggle("col"+a,0,"coversDetailSetMarginsWA")}function hideDetail(c,b){if(b){var a=dgi("col"+c).style;a.height=((phpBrowser=="ie")?1:0)+"px";a.visibility="hidden";a.margin=0;a.padding=0;dgi("det"+c).innerHTML=""}else{dgi("col"+c).style.display="none"}}function trackDetail(h,d){var g,a,c=h.length,b;var f=dgi("trackDetail"+((d=="compact")?"Compact":"Full")).innerHTML;var e=dgi("trackDetail"+((d=="compact")?"Compact":"Full")+"Header").innerHTML.replace(/</g,"<").replace(/>/g,">");var i=dgi("trackDetail"+((d=="compact")?"Compact":"Full")+"Footer").innerHTML.replace(/</g,"<").replace(/>/g,">");for(a=0;a<c;a++){b=h[a];g=f.replace(/TRACKTIME/,formatedTime(b[2])).replace(/TRACKNAME/g,b[1]).replace(/TRACKID/g,b[0]);g=g.replace(/ARTISTNAME/,b[3]).replace(/ALBUMNAME/g,b[4]).replace(/PARITY/,(a%2)?"odd":"even");e+=g.replace(/TRACKNUMBER/,a+1)}return e+i}function insertDetail(e,j,d,f){var k,g,b,c,h="",l="",a="",m;if(e=="Artist"){m=dgi("name"+d).innerHTML;k=dgi("albumDetail"+j.substr(7)).innerHTML;if(dgi("detHeader"+d)){h=dgi("detHeader"+d).innerHTML.replace(/ARTISTNAME/,m)}for(g=0;g<f.length;g++){c=f[g];a=k.replace(/ITEMID/g,"destId"+d+"-"+g);a=a.replace(/ALBUMNAMEJS/g,c[0].replace(/'/g,"\\'"));a=a.replace(/ALBUMNAME/g,c[0]);a=insertCover(a,c[1]);a=a.replace(/YEAR/,c[2]);a=a.replace(/TOTALTIME/,formatedTime(c[3]));a=a.replace(/NBTRACKS/g,c[4]);a=a.replace(/ARTISTNAMEJS/g,m.replace(/'/g,"\\'"));a=a.replace(/ARTISTNAME/g,m);l=trackDetail(c[5],"compact");if(g==f.length-1){a=a.replace(/ENDSEPARATOR=""/i,'style="display:none"')}h+=a.replace(/TRACKS/,l)}}if(e=="Album"){m=(dgi("artistName"+d))?dgi("artistName"+d).innerHTML:"";albumName=dgi("name"+d).innerHTML;if(dgi("detHeader"+d)){h=dgi("detHeader"+d).innerHTML.replace(/ALBUMNAME/,m)}h+=trackDetail(f,"compact");h=dgi("albumTrackDetailCompact").innerHTML.replace(/TRACKS/g,h)}if(e=="Playlist"){h+=trackDetail(f,"full");h=dgi("albumTrackDetailCompact").innerHTML.replace(/TRACKS/g,h)}dgi("det"+d).innerHTML=h;showDetail(e,0,0,d,1)}function updateSelect(d){var c="";var a="";for(var b=0;b<d.length;b++){c+='<option value="'+b+'"'+((d[b].substr(0,1)=="S")?" selected":"")+">"+d[b].substr(1)+"</option>"}if(d.length>0){dgi("selectionRange").innerHTML='<select size="1" class="textInput" onChange="changeOffset(this.value)">'+c+"</select>"}else{dgi("selectionRange").innerHTML=""}}function displayList(j,b,h,g,f,e,a){var d="",c;mDBGroupBy=j;mDBDisplayType=b;mDBMixedFilter=h;mDBDestId=false;mDBData=g;mDBNbItems=g.length;if(a){updateSelect(f)}switch(j){case"artist":for(c=0;c<g.length;c++){d+=groupByArtist(h,g[c],c+e)}break;case"album":for(c=0;c<g.length;c++){d+=groupByAlbum(h,g[c],c+e)}break;case"playlist":for(c=0;c<g.length;c++){d+=groupByPlaylist(h,g[c],c+e)}break;case"tracks":for(c=0;c<g.length;c++){d+=groupByTrack(g[c],c+e)}default:}if(a){dgi("selectionDiv").innerHTML=d}else{dgi("selectionDiv").innerHTML+=d}if(a&&g.length==0){displayNoResults()}}function displayNoResults(){dgi("selectionDiv").innerHTML=dgi("noSearchResult").innerHTML}function groupByArtist(b,d,a){if(b=="searchCompact"){b="artistCompact"}if(b=="searchCovers"||b=="searchFull"){b="artistFull"}var c=dgi("groupByA"+b.substr(1)).innerHTML;c=c.replace(/ITEMID/g,"Artist"+a);c=insertCover(c,d[3]);c=c.replace(/ARTISTNAMEJS/g,d[0].replace(/'/g,"\\'"));c=c.replace(/ARTISTNAME/g,d[0]);c=c.replace(/NBTRACKS/,d[2]);c=c.replace(/PARITY/,(a%2)?" odd":" even");if(b=="artistCompact"&&d[2]>1){c=c.replace(/hidden/,"")}return c.replace(/NBALBUMS/,d[1])}function groupByAlbum(b,d,a){if(b=="searchCompact"){b="albumCompact"}if(b=="searchCovers"||b=="searchFull"){b="albumFull"}var c=dgi("groupByA"+b.substr(1)).innerHTML;c=c.replace(/ITEMID/g,"Album"+a);c=insertCover(c,d[4]);c=c.replace(/ARTISTNAMEJS/g,d[1].replace(/'/g,"\\'"));c=c.replace(/ALBUMNAMEJS/g,d[0].replace(/'/g,"\\'"));c=c.replace(/ARTISTNAME/g,d[1]);c=c.replace(/ALBUMNAME/g,d[0]);c=c.replace(/TOTALTIME/,formatedTime(d[3]));c=c.replace(/PARITY/,(a%2)?" odd":" even");if(b=="albumCompact"&&d[2]>1){c=c.replace(/hidden/,"")}return c.replace(/NBTRACKS/,d[2])}function groupByTrack(b,a){t=dgi("trackGroup").innerHTML;t=t.replace(/ITEMID/g,"Tracks"+a);t=t.replace(/TRACKID/g,b[0]);t=t.replace(/ARTISTNAMEJS/g,b[3].replace(/'/g,"\\'"));t=t.replace(/ALBUMNAMEJS/g,b[2].replace(/'/g,"\\'"));t=t.replace(/ARTISTNAME/g,b[3]);t=t.replace(/ALBUMNAME/g,b[2]);t=t.replace(/TRACKNAME/g,b[1]);t=t.replace(/PARITY/,(a%2)?" odd":" even");return t.replace(/TRACKTIME/,formatedTime(b[4]))}function groupByPlaylist(b,d,a){var c=dgi("groupByPlaylistCompact").innerHTML;c=c.replace(/ITEMID/g,"Playlist"+a);c=c.replace(/PLAYLISTID/g,d[0]);c=c.replace(/PLAYLISTNAME/g,d[1]);c=c.replace(/PARITY/,(a%2)?" odd":" even");return c.replace(/NBTRACKS/,d[2])}D.onkeyup=validateSearch;